package com.example.concurrency.exercise;

import java.util.concurrent.RecursiveAction;
import java.util.concurrent.RecursiveTask;

/**
 * @author: dangwen
 * @createDate: 2021/2/4
 */
public class ForkJoinDemo {
    public static void main(String[] args) {

        RecursiveAction recursiveAction = new RecursiveAction() {
            @Override
            protected void compute() {
                System.out.println("1");
            }
        };
        recursiveAction.invoke();

        RecursiveTask recursiveTask = new RecursiveTask<Integer>() {
            @Override
            protected Integer compute() {
                System.out.println("2");
                return 2;
            }
        };
        recursiveTask.invoke();

    }
}
